package com.yang.newCustomersTransferBackProcess.dao;

import com.yang.newCustomersTransferBackProcess.pojo.RideRecord;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface RideRecordDao extends JpaRepository<RideRecord, Integer>, JpaSpecificationExecutor<RideRecord> {

    @Query(value = "select * from ride_record where user_id = ?1 and status = 1 order by created_at desc limit 1", nativeQuery = true)
    RideRecord queryNewestRideRecord(int userId);
}
